/*
 * Created on Sat Sep 16 2017
 * @flow
 * Copyright (c) 2017 jianglinjie
 */
'use strict';

import NetRequest from './NetRequest';
import * as HttpMethod from '../constants/HttpMethod';
import * as ResponseType from '../constants/ResponseType';

/**
 * 封装body 类型为application/json
 * 
 * @export
 * @class JSONRequest
 * @extends {NetRequest}
 */
export default class JSONRequest extends NetRequest {
  constructor(url: string, 
    urlParam: ?Object, 
    json: any, 
    method: string = HttpMethod.POST,
    responseType: string = ResponseType.JSON_TYPE) {
    super(url, 
      urlParam, 
      JSON.stringify(json), 
      { 'Content-Type': 'application/json' }, 
      method, 
      responseType);
  }
}